﻿import numpy as np
import os
import matplotlib.pyplot as plt
from GeneralMethod.CostFunction.mse_cost_function import mse_cost_function
from Dataset.MyDataset.LinearClassification.logical_classification_dateset import (
    get_data,
)

X, y = get_data()

# 示例用法
# 初始化参数
theta = np.zeros(X.shape[1])
# 计算成本和梯度
cost, grad = mse_cost_function(X, y, theta)
print("Cost:", cost)
print("Gradient:", grad)


# 可视化数据集
plt.figure(figsize=(8, 6))
plt.scatter(X[y == 0][:, 0], X[y == 0][:, 1], color="red", label="Class 0")
plt.scatter(X[y == 1][:, 0], X[y == 1][:, 1], color="blue", label="Class 1")
plt.title("Logical Classification Dataset")
plt.xlabel("Feature 1")
plt.ylabel("Feature 2")
plt.legend()


# 显示图像
plt.show()
